#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import Union

from sqlalchemy import String, ForeignKey
from sqlalchemy.orm import Mapped, mapped_column

from backend.app.core.models.base import Base, id_key


class DbmsInstanceSalt(Base):
    """系统api"""

    __tablename__ = 'dbms_instance_user_salt'

    id: Mapped[id_key] = mapped_column(init=False)
    salt_id: Mapped[int | None] = mapped_column(
        ForeignKey('tag.id', ondelete='SET NULL'), default=None, comment='标签关联ID'
    )
    instance_id:  Mapped[int | None] = mapped_column(
        ForeignKey('tag.id', ondelete='SET NULL'), default=None, comment='标签关联ID'
    )
    salt: Mapped[str] = mapped_column(String(50), unique=True, comment='tag代码')
    salt_pass: Mapped[str] = mapped_column(String(50), unique=True, comment='tag代码')
    salt_username: Mapped[str] = mapped_column(String(50), unique=True, comment='tag代码')
    status: Mapped[int] = mapped_column(default=1, comment='角色状态（0停用 1正常）')
    remark: Mapped[str | None] = mapped_column(String(255), comment='备注')


